/**
 *@author qzg
 *@description 响应函数，包括成功和抛出错误
 *@createDate 2022年06月23日 11:03:43
 */
import { ctx } from '../middlewares/errorHandle'

export const success = (ctx: ctx, message: string, data?: any) => {
  ctx.body = { code: 200, message, data }
}
export const error = (ctx: ctx, code: number, message: string) => {
  ctx.throw(code, message, { isKnown: true })
}
